﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using PaymentHelper;
using PaymentHelper.Core.RelatedObject;
using PaymentHelper.WebTest.Models;
using System.Web.Routing;
using PaymentHelper.Core.Extension;
using PaymentHelper.Core.CommonUtils;

namespace PaymentHelper.WebTest.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/

        public ActionResult Index()
        {
            var paymentFlow = PaymentFlow.PaymentFlowManager.LoadDefaultPaymentFlow();
            PaymentFlow.PaymentFlowManager.Layout = "";

            paymentFlow.OrderPayment = new Core.Order()
            {
                ListOrderItem = new List<OrderItem>() 
                {
                    new OrderItem() { Name="Sách lập trình", Price=30.32m, Quantiy=3, ShortDescription="aaa" },
                    new OrderItem() { Name="Từ điển", Price=20.00m, Quantiy=3, ShortDescription="bbb"},
                    new OrderItem() {Name="Luận Văn", Price=40.00m, Quantiy=5, ShortDescription="ccc"}
                },
                BillingAddress = new Address()
                {
                    Address1 = "345 Lark Ave",
                    City = "San Jose",
                    StateProvince = "CA",
                    Country = "US",
                    Company = "KHTN",
                    Email = "0812491@gmail.com",
                    FirstName = "Luan",
                    LastName = "Van",
                    ZipPostalCode = "95121"
                },
                ShippingFee = 2m,
                CustomerCurrency = "USD"
            };

            var model = paymentFlow.GetFirstStepRoute();

            return RedirectToRoute(model.RouteName);     
        }
    }
}
